using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using DataAccessLayer;
using System.Data;

namespace DataLayer
{
    public class datMails
    {
        public void SelectMailsByMailId(entMails parEntMails, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pMailId",parEntMails.MailId);
            DataTable insDataTable = parDbConnector.ExecuteDataTable("SelectMailsByMailId", insDbParamCollection);
            if (insDataTable.Rows.Count > 0)
            {
                if (insDataTable.Rows[0]["MailId"] != DBNull.Value)
                {
                    parEntMails.MailId = Convert.ToInt32(insDataTable.Rows[0]["MailId"]);
                }
                if (insDataTable.Rows[0]["MailDescription"] != DBNull.Value)
                {
                    parEntMails.MailDescription = insDataTable.Rows[0]["MailDescription"].ToString();
                }
                if (insDataTable.Rows[0]["MailSubject"] != DBNull.Value)
                {
                    parEntMails.MailSubject = insDataTable.Rows[0]["MailSubject"].ToString();
                }
                if (insDataTable.Rows[0]["MailBody"] != DBNull.Value)
                {
                    parEntMails.MailBody = insDataTable.Rows[0]["MailBody"].ToString();
                }
            }
        }
    }
}
